package com.yukefms.common;

/**
 * @Description
 * @Author Ping
 * @Date 2021/6/29 10:34
 **/
public class Counter {
    private int curNum ;
    private int maxNum ;

    public Counter(final int maxNum) {
        this.curNum = 1;
        this.maxNum = maxNum;
    }

    public synchronized void update() {
        this.curNum++ ;
    }
    public int getCurNum() {
        return this.curNum ;
    }
    public synchronized boolean isOverMax() {
        return this.curNum > this.maxNum;
    }
    public synchronized void reset() {
        this.curNum = 0 ;
    }
}
